Check shortname length before read.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 22 Apr 2006 17:05:57 +0000 (17:05 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 22 Apr 2006 17:05:57 +0000 (17:05 +0000)
gpsbabel/lowranceusr.c
gpsbabel/tpg.c

index 1b96fe4b81d685a679a8c3fcd385737522ca25ef..7e4f2a70db3810eb330ff42fd2ed07cef054bc1d 100644 (file)
@@ -338,7 +338,8 @@ lowranceusr_parse_waypt(waypoint *wpt_tmp)
        }
        lowranceusr_fread(&buff[0], 4, 1, file_in);
        TextLen = buff[0];
-       lowranceusr_fread(&buff[0], TextLen, 1, file_in);
+       if (TextLen)
+               lowranceusr_fread(&buff[0], TextLen, 1, file_in);
        buff[TextLen] = '\0';
        wpt_tmp->shortname = xstrdup(buff);
 
index 8cb11f5f3ce409a511dc822726e697b83f777b04..3917062901da9442fd79f5c94ee183faeaa96021 100644 (file)
@@ -161,9 +161,10 @@ tpg_read(void)
            
            stringsize = buff[0];
            
-           tpg_fread(&buff[0], stringsize, 1, tpg_file_in);
-
-           buff[stringsize] = '\0';
+           if (stringsize)
+               tpg_fread(&buff[0], stringsize, 1, tpg_file_in);
+               
+           buff[stringsize] = '\0';
            
            wpt_tmp->shortname = xstrdup(buff);